package com.luojing.springcloud.controller;

import java.security.Principal;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author luojing
 * @create 2018/10/18 2:51 PM
 **/
@RestController
public class TestController {

  @RequestMapping("msg")
  @PreAuthorize("hasAnyAuthority('query')")
  public String getMsg(){
    return "msg";
  }

  @GetMapping("/user")
  public Principal user(Principal user){
    return user;
  }
}
